import { Injectable, Logger } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { ConfigService } from '@nestjs/config';
import { BaseService } from '@wwjCommon/base/base.service';
import { CacheService } from '@wwjCommon/cache/cache.service';
import { LoggingService } from '@wwjCommon/logging/logging.service';
import { UploadService } from '@wwjVendor/upload/upload.service';
import { PayService } from '@wwjVendor/pay/pay.service';
import { SmsService } from '@wwjVendor/sms/sms.service';
import { NoticeService } from '@wwjVendor/notice/notice.service';

@Injectable()
export class AppletVersionSiteService extends BaseService<any> {
  private readonly logger = new Logger(AppletVersionSiteService.name);

  constructor(
    @InjectRepository(Object)
    protected readonly repository: Repository<any>,
    private readonly cacheService: CacheService,
    private readonly configService: ConfigService,
    private readonly loggingService: LoggingService,
    private readonly uploadService: UploadService,
    private readonly payService: PayService,
    private readonly smsService: SmsService,
    private readonly noticeService: NoticeService,
  ) {
    super(repository);
  }

  /**
   * getPage
   * 对应 PHP: AppletVersionSiteService_admin::getPage()
   * 逻辑类型: undefined - undefined
   */
  async getPage(where: any[]) {
    // 基于PHP真实逻辑: getPage
    // PHP原文: return $this->core_applet_site_version_service->getPage($this->site_id, $where);     }      /**      * 获取信息      * @param int $id      * @return array...
return this.core_applet_site_version_service.getPage(this.site_id, where);
    }

    /**
     * 获取信息
     * @param int id
     * @return */
    async getInfo(int id)
    {
        return this.core_applet_site_version_service.getInfo(this.site_id, id);
    }

    /**
     * 查询最后一个下载或升级的版本
     * @param string type
     * @return mixed|string
     * @throws DataNotFoundBusinessException
     * @throws DbBusinessException
     * @throws ModelNotFoundBusinessException
     */
    async getLastVersion(string type){
        return this.core_applet_site_version_service.getLastVersion(this.site_id, type);
    }

    /**
     * 查询可升级的版本
     * @param string type
     * @return null
     */
    async getUpgradeVersion(string type){
        return this.core_applet_site_version_service.getUpgradeVersion(this.site_id, type);
    }
}
  }

  /**
   * getInfo
   * 对应 PHP: AppletVersionSiteService_admin::getInfo()
   * 逻辑类型: undefined - undefined
   */
  async getInfo(id: number) {
    // 基于PHP真实逻辑: getInfo
    // PHP原文: return $this->core_applet_site_version_service->getInfo($this->site_id, $id);     }      /**      * 查询最后一个下载或升级的版本      * @param string $type      * @...
return this.core_applet_site_version_service.getInfo(this.site_id, id);
    }

    /**
     * 查询最后一个下载或升级的版本
     * @param string type
     * @return mixed|string
     * @throws DataNotFoundBusinessException
     * @throws DbBusinessException
     * @throws ModelNotFoundBusinessException
     */
    async getLastVersion(string type){
        return this.core_applet_site_version_service.getLastVersion(this.site_id, type);
    }

    /**
     * 查询可升级的版本
     * @param string type
     * @return null
     */
    async getUpgradeVersion(string type){
        return this.core_applet_site_version_service.getUpgradeVersion(this.site_id, type);
    }
}
  }

  /**
   * getLastVersion
   * 对应 PHP: AppletVersionSiteService_admin::getLastVersion()
   * 逻辑类型: undefined - undefined
   */
  async getLastVersion(type: string) {
    // 基于PHP真实逻辑: getLastVersion
    // PHP原文: return $this->core_applet_site_version_service->getLastVersion($this->site_id, $type);     }      /**      * 查询可升级的版本      * @param string $type      ...
return this.core_applet_site_version_service.getLastVersion(this.site_id, type);
    }

    /**
     * 查询可升级的版本
     * @param string type
     * @return null
     */
    async getUpgradeVersion(string type){
        return this.core_applet_site_version_service.getUpgradeVersion(this.site_id, type);
    }
}
  }

  /**
   * getUpgradeVersion
   * 对应 PHP: AppletVersionSiteService_admin::getUpgradeVersion()
   * 逻辑类型: undefined - undefined
   */
  async getUpgradeVersion(type: string) {
    // 基于PHP真实逻辑: getUpgradeVersion
    // PHP原文: return $this->core_applet_site_version_service->getUpgradeVersion($this->site_id, $type);     } }...
return this.core_applet_site_version_service.getUpgradeVersion(this.site_id, type);
    }
}
  }
}
